<meta title="新增BundleJs发布包" width="600" args="bundleJsPackage"/>
<style>
</style>
<form s="valid,form,nda,datac"
      method="post"
      s-data="bundleJsPackage || {}"
      action="/api/bundleJsPackage"
      id="form" class="form-horizontal">
    <table class="table">
        <tr>
            <td>版本号</td>
            <td>
                <input autocomplete="off" type="text" name="version" s-valid-error="require()" class="form-control" placeholder="版本号">
            </td>
        </tr>
        <tr>
            <td>平台</td>
            <td>
                <select class="form-control input-sm" s="select"
                        s-build="S.get('/api/enum/valuesMap/core.enums.AppPlatform')"
                        name="platform">
                </select>
            </td>
        </tr>
        <tr>
            <td>平台版本号</td>
            <td>
                <input autocomplete="off" type="text" name="platformVersion" s-valid-error="require()" class="form-control" placeholder="平台版本号">
            </td>
        </tr>
        <tr>
            <td>使用缓存</td>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="useCache" value="true" checked />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
        </tr>
        <tr>
            <td>显示IOS隐藏内容</td>
            <td>
                <label class="s-checkbox-switch">
                    <input autocomplete="off" type="checkbox" name="iosShow" value="true" />
                    <span class="s-checkbox-indicator"></span>
                </label>
            </td>
        </tr>
    </table>
</form>
<script>
    if(bundleJsPackage) {
        $form.node.attr("action", "/api/bundleJsPackage/" + bundleJsPackage.id)
        $form.node.attr("method", "put")
    }
    S.meta.btns = [
        {
            name: "确定",
            style: "btn btn-primary",
            click: function() {
                return $form.submit().done(function() {
                    S.close(true)
                })
            }
        },
        {
            name: "关闭",
            style: "btn btn-default",
            click: function() {
                S.close();
            }
        }
    ]

    function selectPackage() {
        S.popupOpen("/oss/objects-selector.html", {prefix: 'bundlejs-package'}).done(function(datas) {
            if(!datas) {
                return;
            }
            $bundleJsPackage.node.val(datas[0].url)
        })
    }

</script>